<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
      html,
      body {
        margin: 0;
        padding: 0;
      }

      .box {
        display: flex;
        justify-content: center;
        align-items: center;
        background: #222;
        margin: 0 auto;
        width: 200vh;
        height: 100vh;
      }

      .box h1 {
        position: relative;
        margin: 0;
        padding: 0;
        font-family: '微软雅黑';
        font-size: 8rem;
        letter-spacing: -0.3rem;
        color: #333;
        cursor: pointer;
      }
      .box h1::after {
        position: absolute;
        top: 0;
        left: 0;
        content: attr(data-spotlight);
        color: transparent;
        -webkit-clip-path: ellipse(100px 100px at 0% 50%);
        clip-path: ellipse(100px 100px at 0% 50%);
        background-image: url('./bg.png');
        background-position: center center;
        background-size: 150%;
        -webkit-background-clip: text;
        background-clip: text;
      }
      .box h1:hover:after {
        animation: spotlight 5s infinite;
      }
      @keyframes spotlight {
        0% {
          /*聚光灯在左*/
          -webkit-clip-path: ellipse(100px 100px at 0% 50%);
          clip-path: ellipse(100px 100px at 0% 50%);
        }
        50% {
          /*聚光灯在右*/
          -webkit-clip-path: ellipse(100px 100px at 100% 50%);
          clip-path: ellipse(100px 100px at 100% 50%);
        }
        100% {
          /*聚光灯在左*/
          -webkit-clip-path: ellipse(100px 100px at 0% 50%);
          clip-path: ellipse(100px 100px at 0% 50%);
        }
      }
    </style>
  </head>
  <body>
    <div class="box">
      <h1 data-spotlight="CodingStartup">CodingStartup</h1>
    </div>
  </body>
</html>
